package world.snowcrystal.nova.mapper;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import world.snowcrystal.nova.statistic.AppAnswerCount;
import world.snowcrystal.nova.statistic.ResultAnswerCount;

import java.util.List;

public interface UserAnswerStatisticMapper {


    @Select("select appId ,count(userId) as userCount from user_answer\n" +
            "group by appId order by userCount desc limit 10;")
    List<AppAnswerCount> getTop10AppAnswerCount();


    @Select("select resultName ,count(resultName) as answerCount from user_answer where appId=#{appId} and  resultName IS NOT NULL group by resultName order by answerCount desc;")
List<ResultAnswerCount> getResultAnswerCountByAppId(@Param("appId") Long appId);


}
